// TickerTest.cpp : Implementation of WinMain


// Note: Proxy/Stub Information
//      To build a separate proxy/stub DLL, 
//      run nmake -f TickerTestps.mk in the project directory.

#include "stdafx.h"
#include "resource.h"
#include "../TickerWindow.h"
#include "../interface/TickerContentIF.h"

CComModule _Module;

typedef INewsContentProvider* CreateFunc();
typedef void ReleaseFunc(INewsContentProvider* pvdr);


int APIENTRY WinMain( HINSTANCE hInstance, HINSTANCE, LPSTR, int )
{
   _Module.Init( NULL, hInstance );

   CreateFunc* Create;
   ReleaseFunc* Release;
   CTickerWindow* pwnd = new CTickerWindow();
   RECT rc = {400, 400, 600, 450};
   pwnd->Create( NULL, rc, _T("Ticker"),
      WS_OVERLAPPEDWINDOW|WS_VISIBLE, WS_EX_CLIENTEDGE  );

   HMODULE hLava = LoadLibrary("LavalampProvider.dll");
   if (!hLava) {
      _Module.Term();
	  return -1;
   }
   
   Create = (CreateFunc*)GetProcAddress(hLava, "CreateProvider");
   Release = (ReleaseFunc*)GetProcAddress(hLava, "ReleaseProvider");
   INewsContentProvider* pvdr = Create();
   
   pwnd->AddProvider(pvdr);
   pwnd->SetMoveStep(5);
   MSG msg;
   while( GetMessage( &msg, NULL, 0, 0 ) ){
      TranslateMessage( &msg );
      DispatchMessage( &msg );
   }

   delete (pwnd);
   Release (pvdr);
   FreeLibrary(hLava);
   _Module.Term();
   return msg.wParam;
}
